//引入封装好的接口
import {getMenuList} from '../../../request/api'
//封装接口的数据类型
interface menuState{
    menuList:Array<object>
}
const state={
    menuList:[]
}
const getters = {
    getMenu(state:menuState){
        return state.menuList
    }
}
const mutations ={
    REQ_MENU(state:menuState,payload:any){
        state.menuList = payload
    }
}
const actions ={
    changeMenuAction({commit}:any){
        getMenuList()
        .then((res:any)=>{
            console.log(res,'菜单列表')
            commit('REQ_MENU',res.data.list)
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}